import java.util.InputMismatchException;
import java.util.Scanner;

public class HumanPlayer extends Player {

    public HumanPlayer(char symbol, Board board, String name) {
        super(symbol, board, name);
    }

    @Override
    public void makeMove(Board board) {
        int playerMove = getMove();
        while (!board.drawMove(symbol, playerMove)) {
            System.out.println("This line is not drawable.");
            playerMove = getMove();
        }
    }

    private int getMove() {
        Scanner scanner = new Scanner(System.in);
        int input;
        while (true) {
            try {
                input = scanner.nextInt();
                return input - 1;
            } catch (InputMismatchException e) {
                System.out.println("Illegal Input.");
                scanner.next();
            }
        }
    }
}
